/**
 * 
 */
package fr.cie.blog.controller;

import java.util.List;

import fr.cie.blog.beans.Avatar;
import fr.cie.blog.domainservice.IServiceAvatar;

/**
 * @author Jee3
 * 
 */
public class AvatarAction extends GenericAction {

	/**
	 * serialVersionUID.
	 */
	private static final long serialVersionUID = -5147914664349962460L;
	/**
	 * avatar.
	 */
	private Avatar avatar;
	/**
	 * avatarList.
	 */
	private List<Avatar> avatarList;

	/**
	 * serviceAvatar.
	 */
	private IServiceAvatar serviceAvatar;

	/**
	 * Constructor.
	 * 
	 * @param pserviceAvatar
	 *            serviceAvatar
	 */
	public AvatarAction(final IServiceAvatar pserviceAvatar) {
		super();
		serviceAvatar = pserviceAvatar;
	}

	/**
	 * @return the avatar
	 */
	public final Avatar getAvatar() {
		return avatar;
	}

	/**
	 * @return the avatarList
	 */
	public final List<Avatar> getAvatarList() {
		return avatarList;
	}

	/**
	 * @return the serviceAvatar
	 */
	public final IServiceAvatar getServiceAvatar() {
		return serviceAvatar;
	}

	/**
	 * @param pAvatar
	 *            the avatar to set
	 */
	public final void setAvatar(final Avatar pAvatar) {
		avatar = pAvatar;
	}

	/**
	 * @param pAvatarList
	 *            the avatarList to set
	 */
	public final void setAvatarList(final List<Avatar> pAvatarList) {
		avatarList = pAvatarList;
	}

	/**
	 * @param pServiceAvatar
	 *            the serviceAvatar to set
	 */
	public final void setServiceAvatar(final IServiceAvatar pServiceAvatar) {
		serviceAvatar = pServiceAvatar;
	}

	/**
	 * @param avatarName
	 *            avatar name
	 * @return the found avatar, null otherwise
	 */
	public final String findByName(final String avatarName) {
		avatar = serviceAvatar.findByName(avatarName);
		return SUCCESS;
	}

}
